package com.imooc.distributedemo.resume.thread;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

public class CompletableFutureDemo {
    public static void main(String[] args) throws ExecutionException,InterruptedException {
        CompletableFuture<String> future = new CompletableFuture<>();
        future.thenAccept(result-> System.out.println("event1 processed"+result));
        future.thenAccept(result-> System.out.println("event2 processed"+result));
        future.thenAccept(result-> System.out.println("event3 processed"+result));
        future.complete("hello,CompletableFuture finished!");
        boolean bool = future.isDone();
        System.out.println(bool);
    }
}
